//
//  VerificationCodeViewController.m
//  OAProject
//
//  Created by yhj on 2017/7/10.
//  Copyright © 2017年 cdnunion. All rights reserved.
//  输入验证码主界面

#import "VerificationCodeViewController.h"
#import "ModifyPasswordViewController.h"


@interface VerificationCodeViewController ()

@end

@implementation VerificationCodeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.

    [self configUI];
}

-(void)configUI
{
    NSString *tipStr=@"您的账号13120568228正在找回登录密码,验证码已发送至您的手机：13120568228";

    NSArray *arr=@[[tipStr substringWithRange:NSMakeRange(0,24)],
                      [tipStr substringWithRange:NSMakeRange(25,6)],
                      [tipStr substringWithRange:NSMakeRange(31,16)]];
    for (NSInteger i=0;i<3;i++)
    {
        UILabel *label=[self.view getLabelWithText:arr[i] font:FontNumber(14) textColor:DarkGreyColor textAlignment:NSTextAlignmentLeft lineBreakMode:NSLineBreakByTruncatingTail numberOfLines:1];
        label.frame=CGRectMake(kmargin*4,74+30*(i%3),APPW-kmargin*8,30);
        [self.view addSubview:label];
    }

    UIView *bgView=[[UIView alloc]initWithFrame:CGRectMake(0,74+30*3+20,APPW,50)];
    bgView.backgroundColor=WhiteColor;
    [self.view addSubview:bgView];


    UIButton *codeBtn=[AppUI createButtonWithText:@"获取验证码" andWithTextColor:MainColor andWithFontfloat:16 andWithBtnAction:^{

    }];
    ViewBorderRadius(codeBtn,kmargin,1,MainColor);
    [bgView addSubview:codeBtn];
    codeBtn.frame=CGRectMake(APPW*2/3,kmargin,APPW/3-kmargin,kmargin*3);


    UITextField *textTF=[[UITextField alloc]initWithFrame:CGRectMake(kmargin,0,APPW/2-kmargin*2,50)];
    textTF.placeholder=@"请输入您的验证码";
    textTF.textColor=LightGreyColor;
    [bgView addSubview:textTF];



    UIButton *nextBtn=[AppUI createButtonWithText:@"下一步" andWithTextColor:WhiteColor andWithFontfloat:18 andWithBtnAction:^{
        if (textTF.text.length==0)
        {
            [self.view makeToast:@"请输入您的验证码" duration:1 position:CSToastPositionCenter];
        }
        else
        {
            ModifyPasswordViewController *vc=[ModifyPasswordViewController new];
            [self.navigationController pushViewController:vc animated:NO];
        }
    }];
    nextBtn.backgroundColor=MainColor;
    ViewBorderRadius(nextBtn,kmargin,1,ClearColor);
    [self.view addSubview:nextBtn];
    nextBtn.frame=CGRectMake(kmargin*2,CGRectGetMaxY(bgView.frame)+kmargin*4,APPW-kmargin*4,kmargin*4);

}

@end
